import hilog from "@ohos.hilog";


/**
 * 日志输出类
 */
export default class L {
  public static d(tag: string, message: string, ...args: any[]) {
    if (hilog.isLoggable(0xFFFF, message, hilog.LogLevel.DEBUG)) {
      hilog.debug(0xFFFF, tag, message, args);
    } else {
      console.log(tag + ":" + message, args);
    }
  }

  public static e(tag: string, message: string, ...args: any[]) {
    if (hilog.isLoggable(0xFFFF, message, hilog.LogLevel.ERROR)) {
      hilog.error(0xFFFF, tag, message, args);
    } else {
      console.log(tag + ":" + message, args);
    }
  }

  public static i(tag: string, message: string, ...args: any[]) {
    if (hilog.isLoggable(0xFFFF, message, hilog.LogLevel.INFO)) {
      hilog.info(0xFFFF, tag, message, args);
    } else {
      console.log(tag + ":" + message, args);
    }
  }

  public static w(tag: string, message: string, ...args: any[]) {
    if (hilog.isLoggable(0xFFFF, message, hilog.LogLevel.WARN)) {
      hilog.warn(0xFFFF, tag, message, args);
    } else {
      console.log(tag + ":" + message, args);
    }
  }
}
